<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
</head>
<body>
    <input id="test" type="text" />	
</body>
<script type="text/javascript">
    var test=document.getElementById('test');
    var scrollFun=function(e){
        var direct=0;
        e=e || window.event;
        if(e.wheelDelta){
            direct=e.wheelDelta>0?1:-1;
        }else if(e.detail){
            direct=e.detail<0?1:-1;
        }
        cTxt(direct)
    }

    function cTxt(arg){
        test.focus();
        if(test.value==""){
            test.value=0;
        }
        var _value=parseInt(test.value);
        arg>0?_value++:_value--;
        test.value=_value;
        test.select();
    }
    
function addScrollListener(element, wheelHandle) {
    if(typeof element != 'object') return;
    if(typeof wheelHandle != 'function') return;
    if(typeof arguments.callee.browser == 'undefined') {
        var user = navigator.userAgent;
        var b = {};
        b.opera = user.indexOf("Opera") > -1 && typeof window.opera == "object";
        b.khtml = (user.indexOf("KHTML") > -1 || user.indexOf("AppleWebKit") > -1 || user.indexOf("Konqueror") > -1) && !b.opera;
        b.ie = user.indexOf("MSIE") > -1 && !b.opera;
        b.gecko = user.indexOf("Gecko") > -1 && !b.khtml;
        arguments.callee.browser = b;
    }
    if(element == window)
        element = document;
    if(arguments.callee.browser.ie)
        element.attachEvent('onmousewheel', wheelHandle);
    else
        element.addEventListener(arguments.callee.browser.gecko ? 'DOMMouseScroll' : 'mousewheel', wheelHandle, false);
}

addScrollListener(window, scrollFun);
</script>
</html>
